import java.util.Scanner;

public class demo {
    /*public static void main(String[] args) {
        int n=1234;
        factor(n);
    }
    public static void factor(int n){
        if(n>9){
            factor(n/10);
        }
        System.out.print(n%10+"  ");
    }*/
    /*public static void main(String[] args) {
        int n=10;
        System.out.println(add(n));
    }
    public static int add(int n){
        int sum;
        if(n<=1){
            return n;
        }
        return sum=n+add(n-1);
    }*/
    public static void main(String[] args) {
        System.out.println("请输入一个非零的整数");
        Scanner scan = new Scanner(System.in);
        int n=scan.nextInt();
        System.out.println("各位数的和为："+sum(n));
    }
    public static int sum(int n){
        if(n<10){
            return n;
        }
        return sum(n%10)+sum(n/10);
    }
}
